<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); 

class TokenStub {
	public static function getToken($force = false) {
			
		$para = array(
			"grant_type" => "client_credential",
			"appid" => WX_API_APPID,
			"secret" => WX_API_APPSECRET
		);
		
		$url = WX_API_URL . "token";
		$ret = doCurlGetRequest($url, $para);
		
		$retData = json_decode($ret, true);
		if(!$retData || isset($retData['errcode'])) {
			return false;
		}
		$token = $retData['access_token'];
		$expire = $retData['expires_in'];
		
		return $token;
		
	}
}